#include <iostream>
#include<string>
using namespace std;

struct box
{
	string maker;
	float height;
	float width;
	float length;
	float volume;
};

void show_box (box a);              //pass the value of struct
void set_box_volume (box *a);  //pass the address of struct

void main()
{
	box user;
	cout << "please input the detail of your box(including its maker, height, width and length)\n";
	cout << "the maker of your box:_\b ";
	getline(cin,user.maker);
	/*cout << "height:_\b";
	cin >> user.height;
	cout << "width:_\b";
	cin >> user.width;
	cout << "length:_\b";
	cin >> user.length; */
	cout << "enter the box's 3D (height width and length in order):__  __  __\b\b\b\b\b\b\b\b\b\b";
	while (!(cin >> user.height >> user.width >> user.length))   //bad input
	{
		cin.clear();
		while (cin.get() != '\n')
			continue;
		cout << "Bad input, please enter again.";
		cout << "enter the box's 3D (height width and length in order):__  __  __\b\b\b\b\b\b\b\b\b\b";
	}

	set_box_volume(&user);

	show_box(user);

	system("pause");
};

void show_box(box a)
{
	cout << "here is the detail of the box: \n" << "maker: " << a.maker << endl;
	cout << "height: " << a.height << "  width: " << a.width << "  length: " << a.length << endl;
	cout << "volume: " << a.volume << endl;
};

void set_box_volume(box *a)
{
	a->volume = a->height*a->width*a->length;
};